package com.zfei.gfb.request;

import cn.hutool.core.lang.Validator;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import com.zfei.gfb.util.ObjUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;


/**
 * @author fgh
 */
@Data
public class GfbGreenPlotAddRequest {

    // 菜地名称
    @ApiModelProperty(value = "菜地名称", required = true)
    private String name;
    // 图片url集合,json数组形式
    @ApiModelProperty(value = "图片url集合,json数组形式", required = true)
    private List<String> images;
    // 菜地面积
    @ApiModelProperty(value = "菜地面积", required = true)
    private Float area;
    // 联系人电话
    @ApiModelProperty(value = "联系人电话", required = true)
    private String phone;
    // 认领价格
    @ApiModelProperty(value = "认领价格", required = true)
    private Integer price;
    // 地图坐标
    @ApiModelProperty(value = "地图坐标", required = true)
    private String point;
    // 地址
    @ApiModelProperty(value = "地址", required = true)
    private String address;
    // 菜地介绍
    @ApiModelProperty(value = "菜地介绍", required = true)
    private String content;


    public void checkInsertNull() {
        if (ObjUtil.anyNull(name, images, area, phone, price, point, address, content)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
//        if(!Validator.isMobile(phone)){
//            throw new StatusException(Status.INVALID_ARGUMENT);
//        }
    }
}

